package com.nimitz.web.controller.module.demo;

import com.nimitz.common.core.controller.BaseController;
import com.nimitz.common.core.page.TableDataInfo;
import com.nimitz.module.demo.domain.DemOrder;
import com.nimitz.module.demo.service.IDemOrder2Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 订单维护
 */
@RestController
@Api(tags = "演示模块-订单维护进阶")
@RequestMapping("/module/demo/order2")
public class DemOrder2Controller extends BaseController {

    @Resource
    private IDemOrder2Service orderService;

    /**
     * 根据条件查询订单列表（含分页）
     *
     * @param brandName 品牌名称
     * @param order     订单
     * @return 订单集合
     */
    @GetMapping("/list")
    @ApiOperation(value = "根据条件查询订单列表（含分页）")
    public TableDataInfo list(@RequestParam("brandName") String brandName, DemOrder order) {
        startPage();
        List<DemOrder> list = orderService.selectOrderList(brandName, order);
        return getDataTable(list);
    }
}
